import { LoadingOutlined } from '@ant-design/icons';
import { Button, ButtonProps } from 'antd';
import React from 'react';

interface Props extends ButtonProps {
  loading?: boolean;
  onClick?: () => void;
  children?: React.ReactNode;
}

const ModalsFooterBtn = ({ children, loading, onClick, ...props }: Props) => {
  return (
    <Button
      {...props}
      className={`!h-auto !w-auto !px-6 !py-2 !text-sm !leading-none`}
      onClick={!loading ? onClick : undefined}
    >
      {loading && <LoadingOutlined />}
      {children}
    </Button>
  );
};

export default ModalsFooterBtn;
